package org.hong.monkey.rdd

import org.hong.monkey.{MonkeyContext, Partition, TaskContext}

import scala.reflect.ClassTag

/**
 * An RDD partition used to recover checkpointed data.
 */
private[monkey] class CheckpointRDDPartition(val index: Int) extends Partition

/**
 * An RDD that recovers checkpointed data from storage.
 */
private[monkey] abstract class CheckpointRDD[T: ClassTag](sc: MonkeyContext)
  extends RDD[T](sc, Nil) {

  // CheckpointRDD should not be checkpointed again
  override def doCheckpoint(): Unit = { }
  override def checkpoint(): Unit = { }
  override def localCheckpoint(): this.type = this

  // Note: There is a bug in MiMa that complains about `AbstractMethodProblem`s in the
  // base [[org.hong.monkey.rdd.RDD]] class if we do not override the following methods.
  // scalastyle:off
  protected override def getPartitions: Array[Partition] = ???
  override def compute(p: Partition, tc: TaskContext): Iterator[T] = ???
  // scalastyle:on

}
